<admintpl file="header" />
<link rel="stylesheet" type="text/css" href="__PUBLIC__/js/webuploader/webuploader.css">
<link rel="stylesheet" type="text/css" href="__TMPL__Public/assets/css/spectrum.css">
<style type="text/css">

</style>
</head>
<body>
	<div class="wrap js-check-wrap">
		<form class="form-horizontal js-ajax-form" action="{:U('AdminEMallAD/postSliderAD',array('id'=>$id,'adKey'=>$adKey,'postType'=>'edit'))}" method="post">
			<div class="tabbable">
		        <div class="tab-content">
		          <div class="tab-pane active" id="A">
						<fieldset>
							<div class="control-group">
								<label class="control-label">{:L('AD_TITLE')}</label>
								<div class="controls">
									<input type="text" name="ad_title" value="" required><span class="form-required"> *</span>
								</div>
							</div>
							<div class="control-group">
								<label class="control-label">{:L('SECOND_TITLE')}</label>
								<div class="controls">
									<input type="text" name="second_title" value="">
								</div>
							</div>
							<div class="control-group">
								<label class="control-label">{:L('SUB_TITLE')}</label>
								<div class="controls">
									<input type="text" name="sub_title" value="">
								</div>
							</div>
							<div class="control-group">
								<label class="control-label">{:L('AD_LINK')}</label>
								<div class="controls">
									<input type="text" name="ad_link" value="" style="width:400px" required><span class="form-required"> *</span>
								</div>
							</div>
							<div class="control-group">
								<label class="control-label">{:L('AD_IMAGE')}</label>
								<div class="controls">
									<div id="uploader" style="width:200px;overflow:hidden">
									    <div id="fileList" class="uploader-list">
									    <div id="WU_FILE_0" class="file-item thumbnail upload-state-done"><img class="img-responsive" src=""></div>
									    <input type="hidden" name="UpFilePathInfo" value="">
									    </div>
									    <div id="cfilePicker">选择图片</div>
									</div>
								</div>
							</div>
							<div class="control-group">
								<label class="control-label">{:L('BG_COLOR')}</label>
								<div class="controls">
									<input type="text" name="ad_bgcolor" value="" style="margin-right:10px"><input  type="hidden" id="ad_bgcolor" ><span style=> 幻灯切换时的容器背景色</span>
								</div>
							</div>
							<div class="control-group">
								<label class="control-label">{:L('AD_DURATION')}</label>
								<div class="controls">
								<input type="text" name="start_time" class="js-datetime" value="{$formget.start_time|default=''}" style="width: 120px;" autocomplete="off">-
								<input type="text" class="js-datetime" name="end_time" value="{$formget.end_time|default=''}" style="width: 120px;" autocomplete="off">
								</div>
							</div>
							<div class="control-group">
								<label class="control-label">{:L('STATUS')}</label>
								<div class="controls">
									<select name="ad_status">
										<option value="1">投放</option>
										<option value="0">禁用</option>
									</select>
								</div>
							</div>
							<div class="control-group">
								<label class="control-label">{:L('SORT')}</label>
								<div class="controls">
									<input type="text" name="listorder" value="0"><span class="form-required">*</span>
								</div>
							</div>
						</fieldset>
		          </div>

		        </div>
		    </div>
		    <div class="form-actions">
		     	<button class="btn btn-primary js-ajax-submit" type="submit">{:L('SAVE')}</button>
		      	<a class="btn" href="{:U('AdminEMallAD/manageSliderAD',array('id'=>$id,'ad_name'=>$ad_name))}">{:L('BACK')}</a>
		    </div>
		</form>
	</div>
<script type="text/javascript" src="__PUBLIC__/js/common.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/webuploader/webuploader.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/webuploader/getting-started.js"></script>
<script type="text/javascript" src="__TMPL__Public/assets/js/spectrum.js"></script>
<script type="text/javascript">
// 添加全局站点信息
var BASE_URL = '__PUBLIC__/js/webuploader/';
var UPLOAD_SERVER='{:U("AdminEMallUpload/uploadSinglePic")}';
var imgPath='{:sp_get_image_preview_url()}';
var adData='{$adData.ad_data}';
var id='{$id}';
var adKey='{$adKey}'
$(function() {
	$("#uploader").setUploader(null,{uploadImgType:'normal',thumb:{height:102}});

	if(adData!==''){
		adData=$.parseJSON(adData);
		$(':input[name="ad_title"]').val(adData.AdItem[adKey].ad_title);
		$(':input[name="second_title"]').val(adData.AdItem[adKey].second_title);
		$(':input[name="sub_title"]').val(adData.AdItem[adKey].sub_title);
		$(':input[name="ad_link"]').val(adData.AdItem[adKey].ad_link);
		$(':input[name="ad_bgcolor"]').val(adData.AdItem[adKey].ad_bgcolor);
		$(':input[name="start_time"]').val(adData.AdItem[adKey].start_time);
		$(':input[name="end_time"]').val(adData.AdItem[adKey].end_time);		
		$('select[name="ad_status"]').val(adData.AdItem[adKey].ad_status);
		$(':input[name="listorder"]').val(adData.AdItem[adKey].listorder);
		$(':input[name="UpFilePathInfo"]').val(adData.AdItem[adKey].ad_image);
		$('#uploader img').attr('src',adData.AdItem[adKey].ad_image_thumb_s)
	}

	$('#ad_bgcolor').spectrum({
    color: "",
    allowEmpty:true,
    showInput: true,
    showInitial: true,
    showPalette: true,
    showSelectionPalette: true,
    maxPaletteSize: 10,
    preferredFormat: "hex",
    showAlpha: true,
    localStorageKey: "spectrum.demo",
    palette:[
        ["rgb(0, 0, 0)", "rgb(67, 67, 67)", "rgb(102, 102, 102)",
        "rgb(204, 204, 204)", "rgb(217, 217, 217)","rgb(255, 255, 255)"],
        ["rgb(152, 0, 0)", "rgb(255, 0, 0)", "rgb(255, 153, 0)", "rgb(255, 255, 0)", "rgb(0, 255, 0)",
        "rgb(0, 255, 255)", "rgb(74, 134, 232)", "rgb(0, 0, 255)", "rgb(153, 0, 255)", "rgb(255, 0, 255)"], 
        ["rgb(230, 184, 175)", "rgb(244, 204, 204)", "rgb(252, 229, 205)", "rgb(255, 242, 204)", "rgb(217, 234, 211)", 
        "rgb(208, 224, 227)", "rgb(201, 218, 248)", "rgb(207, 226, 243)", "rgb(217, 210, 233)", "rgb(234, 209, 220)", 
        "rgb(221, 126, 107)", "rgb(234, 153, 153)", "rgb(249, 203, 156)", "rgb(255, 229, 153)", "rgb(182, 215, 168)", 
        "rgb(162, 196, 201)", "rgb(164, 194, 244)", "rgb(159, 197, 232)", "rgb(180, 167, 214)", "rgb(213, 166, 189)", 
        "rgb(204, 65, 37)", "rgb(224, 102, 102)", "rgb(246, 178, 107)", "rgb(255, 217, 102)", "rgb(147, 196, 125)", 
        "rgb(118, 165, 175)", "rgb(109, 158, 235)", "rgb(111, 168, 220)", "rgb(142, 124, 195)", "rgb(194, 123, 160)",
        "rgb(166, 28, 0)", "rgb(204, 0, 0)", "rgb(230, 145, 56)", "rgb(241, 194, 50)", "rgb(106, 168, 79)",
        "rgb(69, 129, 142)", "rgb(60, 120, 216)", "rgb(61, 133, 198)", "rgb(103, 78, 167)", "rgb(166, 77, 121)",
        "rgb(91, 15, 0)", "rgb(102, 0, 0)", "rgb(120, 63, 4)", "rgb(127, 96, 0)", "rgb(39, 78, 19)", 
        "rgb(12, 52, 61)", "rgb(28, 69, 135)", "rgb(7, 55, 99)", "rgb(32, 18, 77)", "rgb(76, 17, 48)"]
    ],
    move: function (color) {

    },
    show: function () {
    	
    },
    beforeShow: function () {
    
    },
    hide: function () {
    
    },
    change: function(color) {
        $(':input[name="ad_bgcolor"]').val(color);
    }
})
});
</script>
</body>
</html>